home *** CD-ROM | disk | FTP | other *** search
- /* TabbedPanel.c */
- /* Created 01/01/95 12:01 PM by AppMaker */
-
- #include <Types.h>
- #include <Quickdraw.h>
- #include <Controls.h>
- #include <Dialogs.h>
- #include <Events.h>
- #include <Lists.h>
- #include <Menus.h>
- #include <Resources.h>
- #include <TextEdit.h>
- #include <ToolUtils.h>
- #include "ResourceDefs.h"
- #include "Globals.h"
- #include "Miscellany.h"
- #include "Scrolling.h"
- #include "WindowAids.h"
- #include "GadgetsData.h"
- #include "TabbedPanel.h"
-
- #define TabPanelPanel 1
- #define DoomGloryLabel 2
- #define HotColdLabel 3
- #define BlueYellowLabel 4
-
-
- /*----------*/
- void OpenTabbedPanel (FSSpec* fileSpec,
- short fRefNum)
- {
- WindowPtr newWindow;
- Rect bounds;
-
- newWindow = GetWindow (WIND_TabbedPanel);
- if (fileSpec->name [0] != 0) {
- SetWTitle (newWindow, fileSpec->name);
- }
- SetPort (newWindow);
- SetNewInfo (newWindow);
- cur->vScroll = nil;
- cur->hScroll = nil;
- cur->fileNum = fRefNum;
- cur->dirty = false;
- cur->filename = NewString (fileSpec->name);
- cur->windowKind = WTabbedPanel;
- ((WindowPeek) curWindow)->windowKind = userKind + WTabbedPanel;
- cur->witlHandle = GetResource ('Witl', WIND_TabbedPanel);
- cur->wictHandle = GetResource ('Wict', WIND_TabbedPanel);
-
- cur->TabPanelHandle = GetNewControl (CNTL_TabPanel, newWindow);
-
- cur->TabPanelValue = 1;
- cur->text = nil;
-
-
- } /*OpenTabbedPanel*/
-
- /*----------*/
- void CloseTabbedPanel (void)
- {
-
- DisposHandle ((Handle) cur->filename);
- DiscardInfo (curWindow);
- } /*CloseTabbedPanel*/
-
- /*----------*/
- void ControlTabbedPanel (ControlHandle whichControl,
- short whichPart,
- Point where)
- {
- Rect bounds;
-
- if (whichControl == cur->TabPanelHandle) {
- if (TrackControl (cur->TabPanelHandle, where, NULL) != 0) {
- cur->TabPanelValue = GetControlValue (cur->TabPanelHandle);
- InvalRect (&curWindow->portRect);
- }
- }
-
- } /*ControlTabbedPanel*/
-
- /*----------*/
- void MouseInTabbedPanel (Point where,
- short modifiers)
- {
- Rect bounds;
-
-
- } /*MouseInTabbedPanel*/
-
- /*----------*/
- void TypeInTabbedPanel (char ch)
- {
- if (cur->text == nil) {
- SysBeep (1);
- } else {
- TEKey (ch, cur->text);
- cur->dirty = true;
- }
- } /*TypeInTabbedPanel*/
-
- /*----------*/
- void UpdateTabbedPanel (void)
- {
- Rect bounds;
-
- SetWFont (TabPanelPanel);
- Draw1Control (cur->TabPanelHandle);
- switch (cur->TabPanelValue) {
- case 1:
- SetWFont (DoomGloryLabel);
- GetWRect (DoomGloryLabel, &bounds);
- TextIDBox (TEXT_DoomGlory, bounds);
- break;
-
- case 2:
- SetWFont (HotColdLabel);
- GetWRect (HotColdLabel, &bounds);
- TextIDBox (TEXT_HotCold, bounds);
- break;
-
- case 3:
- SetWFont (BlueYellowLabel);
- GetWRect (BlueYellowLabel, &bounds);
- TextIDBox (TEXT_BlueYellow, bounds);
- break;
-
- } // switch
- DrawClippedGrow (-15, -15);
- } /*UpdateTabbedPanel*/
-
- /*----------*/
- void ActivateTabbedPanel (Boolean activate)
- {
-
- DrawClippedGrow (-15, -15);
- } /*ActivateTabbedPanel*/
-
- /*----------*/
- void ResizeTabbedPanel (void)
- {
- /* application-specific code to resize items in window */
- } /*ResizeTabbedPanel*/
-
- /*----------*/
- pascal void ScrollTabbedPanel (short newValue,
- short oldValue)
- {
- /* application-specific code to scroll window */
- } /*ScrollTabbedPanel*/
-
- /* TabbedPanel */
-